package com.lz.bos.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lz.bos.dao.UserDao;
import com.lz.bos.domain.User;
import com.lz.bos.service.UserService;
import com.lz.bos.utils.MD5Utils;

@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;

	public User login(User user) {
		String username = user.getUsername();
		String password = user.getPassword();
		password = MD5Utils.md5(password);
		return userDao.findByUsernameAndPassword(username, password);
	}

	public void editPassword(String password, String id) {
		userDao.executeUpdate("editPassword", password, id);
	}
}
